<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-hatchetMerchant-edit" th:object="${hatchetMerchant}">
           <input id="iD" name="iD" th:field="*{iD}"  type="hidden">
           <div class="form-group">
				<label class="col-sm-3 control-label" style="font-weight: bold;">用户账号：</label>
				<div class="form-control-static" th:text="*{merchantNo}">
				</div>
				<label class="col-sm-3 control-label" style="font-weight: bold;">用户名称：</label>
				<div class="form-control-static" th:text="*{merchantCnName}">
				</div>
				<label class="col-sm-3 control-label" style="font-weight: bold;">用户手机号：</label>
				<div class="form-control-static" th:text="*{pHONE}">
				</div>
				<label class="col-sm-3 control-label" style="font-weight: bold;">用户账户总金额：</label>
				<div  id ="totalMoney" class="form-control-static" th:text="*{totalMoney}">
				</div>
				<label class="col-sm-3 control-label" style="font-weight: bold;">推荐人手机号码：</label>
				<div class="form-control-static" th:text="*{parentPhone}">
				</div>
				
				
				<label class="col-sm-3 control-label">
					<font style="font-weight: bold;">
							用户关系：
					</font>
				</label>
				<div class="form-control-static" >
					<!-- 存放用户关系 -->
					<font id="showRelation" color="red">
							
					</font>
				</div>
				<label class="col-sm-3 control-label">
					<font style="font-weight: bold;">
							银行卡列表：
					</font>
				</label>
				<div class="form-control-static" >
					<!-- 存放卡列表 -->
					<table id="limitTable">
						<tr style="font-weight: bold;">
							<td align="center" width="15%">序号</td>
							<td align="center" width="60%">卡号</td>
							<td align="center" width="25%">银行名称</td>
						</tr>
						<tr></tr>
						
					</table>
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
    var prefix = ctx + "system/hatchetMerchantForDLS";
    var id = $("#iD").val();
   $(document).ready(function () { 
			$.ajax({
		        url:prefix+"/showRelation", //请求后台
		        dataType:"json",
		        type: "GET",
		        async:true,
		       data:"id="+id,
		        success:function(re){
		        	var value = $("#totalMoney").text();
		        	$("#totalMoney").text(value+" 元");
		        	var str ="";
		        	//遍历代理商
		            $.each(re, function(i,item) {
		            	str= str+item.type+":"+item.agentName+" | ";
		            });
		            var agent = re[0];
		            var limits = agent.limitList;
		          	//遍历银行卡列表
		          	var limitStr ="";
		            $.each(limits, function(i,item) {
		            	limitStr += "<tr>";
		            	limitStr += "<td align='center'>";
		            	limitStr += (i+1);
		            	limitStr += "</td>";
		            	limitStr += "<td align='center'>";
		            	limitStr += item.bankAccount;
		            	limitStr += "</td>";
		            	limitStr += "<td align='center'>";
		            	limitStr += item.bankName;
		            	limitStr += "</td>";
		            	limitStr += "</tr>";
		            });
		            limitStr += "<tr></tr>";
		            $("#limitTable").append(limitStr);
		            var index = str.lastIndexOf(" | ")
		            str = str.substring(0,index);
		            $("#showRelation").text(str);
		        }
		    });
    	}); 
 			
	</script>
</body>
</html>
